//
// Created by SD on 2023/12/11.
//
#include<bits/stdc++.h>
using namespace std;
struct node{
    int num;
    int  idex;
}a[1003];
bool cmp(node a,node b)
{
    return a.num < b.num;
}
int main()
{
    int n = 0;
    cin >> n;
   for(int i = 1;i <= n;i++ )
   {
       cin >> a[i].num;
       a[i].idex = i;
   }
   sort(a + 1, a + 1 + n,cmp);
   double sum = 0, avg = 0;
   for(int i = 0;i <=n;i++)
   {
       sum+= (a[i].num * (n - i));
   }
   for(int i = 1;i <= n;i++)
   {
       cout << a[i].idex << " ";
   }
    avg = sum / n;
    printf("\n%.2lf",avg);
    return 0;
}